package com.ptu.config;

import com.ptu.util.JwtUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

@Configuration
@EnableWebSocket
public class WebSocketConfig {

    //  注入ServerEndpointExporter,使SpringBoot支持websocket
    @Bean
    public ServerEndpointExporter  serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

    //  注入JwtUtil到Websocket端点
    @Bean
    public JwtUtil jwtUtil() {
        return new JwtUtil();
    }
}
